{{Strip}}{{- $dialog := $.Stored.dialog -}}
{{- $multiple := $.Stored.multiple -}}
{{- $showFilter := $.Form `showFilter` -}}
<div id="search-form-box"{{if not $showFilter}} class="hide"{{end}}>
<div class="row sm-margin-top">
	<div class="col-md-12">
		<div class="block-flat sm-margin-bottom">
			<form class="form-horizontal" action="{{$.URL.Path}}" id="search-form" method="GET">
				<input type="hidden" name="showFilter" value="1" />
				{{- if $.Stored.dialog -}}
				<input type="hidden" name="multiple" value="{{if $multiple}}1{{else}}0{{end}}" />
				<input type="hidden" name="from" value="{{$.Form `from`}}" />
				<input type="hidden" name="callback" value="{{$.Form `callback`}}" />
				{{- end -}}
				{{- if $.Form `filetype` -}}
				<input type="hidden" name="filetype" value="{{$.Stored.fileType}}" />
				{{end}}
			<div class="row no-margin">
				<div class="form-group col-sm-3 no-margin xs-margin-top no-padding">
				<div class="input-group">
					<span class="input-group-addon">{{"文件名称"|$.T}}</span>
					<input type="text" id="saveName" class="form-control" name="saveName" value="{{$.Form `saveName`}}" onkeyup="if(event.keyCode==13)$('#search-form').submit()">
				</div>
				</div>
				<div class="form-group col-sm-3 no-margin xs-margin-top no-padding">
				<div class="input-group">
					<span class="input-group-addon">{{"上传时间"|$.T}}</span>
					<input type="text" id="timerange" class="form-control" name="timerange" value="{{$.Form `timerange`}}">
				</div>
				</div>
				<div class="form-group col-sm-2 no-margin xs-margin-top no-padding">
				<div class="input-group">
					<span class="input-group-addon no-padding no-border"><select name="ownerType" class="form-control" id="ownerType" onchange="ownerTypeChange(this)" style="width:100px">
						{{- $ownerType := $.Form "ownerType" -}}
						<option value="user"{{if eq $ownerType `user`}} selected{{end}}>{{`后台用户`|$.T}}</option>
						<option value="customer"{{if eq $ownerType `customer`}} selected{{end}}>{{`前台客户`|$.T}}</option>
					</select></span>
					<input name="ownerId" class="form-control" id="ownerId" placeholder="{{`用户ID`|$.T}}" value="{{$.Form `ownerId`}}">
				</div>
				</div>
				{{- if not $dialog -}}
				<div class="form-group col-sm-2 no-margin xs-margin-top no-padding">
				<div class="input-group">
					<span class="input-group-addon">{{"文件类型"|$.T}}</span>
					<select name="type" class="form-control" id="type">
						<option value="">-{{"不限"|$.T}}-</option>
						{{- $type := $.Stored.fileType -}} 
						{{- range $k, $v := $.Stored.fileTypes -}}
						<option value="{{$k.String}}"{{if eq $type $k.String}} selected{{end}}>{{$k.String}}</option>
						{{- end -}}
					</select>
				</div>
				</div>
				{{- end -}}
				<div class="form-group col-sm-2 no-margin xs-margin-top no-padding">
				<div class="input-group">
					<span class="input-group-addon">{{"使用状态"|$.T}}</span>
					<select name="used" class="form-control" id="used">
						<option value="">-{{"不限"|$.T}}-</option>
						{{- $used := $.Form "used" -}} 
						<option value="0"{{if eq $used `0`}} selected{{end}}>{{`未使用`|$.T}}</option>
						<option value="1"{{if eq $used `1`}} selected{{end}}>{{`已使用`|$.T}}</option>
					</select>
				</div>
				</div>
				<div class="form-group col-sm-3 no-margin xs-margin-top no-padding">
					<div class="input-group">
						<span class="input-group-addon">{{"文件夹"|$.T}}</span>
						<select name="subdir" class="form-control" id="subdir">
							<option value="">-{{"不限"|$.T}}-</option>
							{{- $subdir := $.Form `subdir` -}} 
							{{- range $k, $v := $.Stored.subdirList -}}
								{{- if $v.H -}}
								<optgroup label="{{$v.V}}">
									<option value="{{$v.K}}"{{if eq $subdir $v.K}} selected{{end}}>{{$v.V}} ({{$v.K}})</option>
									{{- range $ck,$cv := $v.H -}}
									<option value="{{$v.K}}/{{$ck}}"{{if eq $subdir (Concat $v.K `/` $ck)}} selected{{end}}>{{$cv}} ({{$v.K}}/{{$ck}})</option>
									{{- end -}}
								</optgroup>
								{{- else -}}
								<option value="{{$v.K}}"{{if eq $subdir $v.K}} selected{{end}}>{{$v.V}} ({{$v.K}})</option>
								{{- end -}}
							{{- end -}}
						</select>
					</div>
				</div>
			</div><!-- .row -->
			</form>
		</div>
	</div>
</div>
</div>
<div class="row sm-margin-top">
	<div class="col-md-12">
		<div class="block-flat no-padding">
			<div class="header">
				<a href="javascript:;" class="btn btn-default pull-right" onclick="$('#search-form-box').toggleClass('hide');">
					<i class="fa fa-search"></i>
					{{"搜索文件"|$.T}}
				</a>
				<span class="pull-right" id="fileUploadButtonContainer" data-toggle="tooltip" title="{{if $subdir}}{{$.T `上传到搜索框中所选文件夹: %s` $subdir}}{{else}}{{`如要上传到某个文件夹请在搜索框中选中`|$.T}}{{end}}" data-placement="bottom">
					<input type="file" multiple="true" id="input-file-upload" style="width:95px" />
				</span>
				{{- if not $dialog -}}
				<a href="javascript:;" class="btn btn-danger pull-right" data-method="post" onclick="App.removeSelected2(this,'input:checkbox[name=\'id[]\']','id','{{BackendURL}}/manager/file/delete/0');">
					<i class="fa fa-trash-o"></i>
					{{"删除选中"|$.T}}
				</a>
				<h3>{{"附件管理"|$.T}}</h3>
				{{- else -}}
				<a href="javascript:;" class="btn btn-success pull-right" onclick="applySelected();">
					<i class="fa fa-check"></i>
					{{"选择附件"|$.T}}
				</a>
				<h3>{{"选择附件"|$.T}}</h3>
				{{- end -}}
			</div>
			<div class="content">
				<!-- <div class="table-responsive" id="previewTableContainer"></div> -->
				<div id="table-container">
				{{Include "manager/file/list.main.content"}}
				</div>
			</div>
		</div>				
	</div>
</div>
{{/Strip}}